#include <stdio.h>

int main()
{
    int T, t;
    scanf("%d", &T);
    for (t = 0; t < T; t++)
    {
        int n, i, xmin = 99, xmax = 0;
        scanf("%d", &n);
        for (i = 0; i < n; i++)
        {
            int x;
            scanf("%d", &x);
            if (x < xmin)
                xmin = x;
            if (x > xmax)
                xmax = x;
        }
        printf("%d\n", (xmax - xmin) * 2);
    }
    return 0;
}